package com.wzxl.bean;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wzxl.bean.Role;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.*;
import java.util.List;

/**
 * @author rxbyes
 * @version V1.0
 * @package com.wzxl.bean.sys
 * @description: TODO ( JPA 客户实体 )
 * @date 2017 上午9:46
 */

@Data
@Entity
@Table(name="admin")
public class User extends BaseEntity{

    @Id
    @Column(name = "uid")
    @GeneratedValue(generator = "UUID")
    private String uid;

    @NotEmpty(message="账号不能为空")
    private String username;

    private String password;

    private String salt;

    private Integer state;

    private Integer isSystem;

    private String createdAt;

    private String updatedAt;

    @Transient
    @JsonIgnore
    private String sort = "";

    @Transient
    @JsonIgnore
    private String order = "";

    @Transient
    private String[] roleId;

    @Transient
    private List<Role> roleList;

    public String getCredentialsSalt() {
        return this.username + this.salt;
    }
}


